package controllers;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

import modelo.Combobebida;
import modelo.Combobebidaxsalon;
import modelo.Detallecombobebida;
import modelo.Insumo;
import modelo.Menu;
import modelo.Propietario;
import modelo.Salon;
import modelo.Servicioadicionalxsalon;
import modelo.Tiposuscripcion;
import modelo.Usuario;
import services.ComboBebidaService;
import services.ComboBebidaXSalonService2;
import services.DetalleComboBebidaService;
import services.InsumoService;
import services.MenuService;
import services.PropietarioService;
import services.SalonService;
import services.ServicioAdicionalXSalonService;
import services.TipoSuscripcionService;


@ManagedBean(name="consultarcombobebidaxsalonBean")
@ViewScoped
public class ConsultarComboBebidaXSalonBean implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -1076328145908055625L;
	@ManagedProperty("#{comboBebidaXSalonService2}")
	private ComboBebidaXSalonService2 serviceComboBebidaXSalon=new ComboBebidaXSalonService2();
	private Combobebidaxsalon combobebidaxsalon=new Combobebidaxsalon();
	
	@ManagedProperty("#{comboBebidaService}")
	private ComboBebidaService combobebidaService = new ComboBebidaService();
	private Combobebida comboBebidaSelected; 
    private List<Combobebida> listaComboBebida;

	@ManagedProperty("#{salonService}")
	private SalonService serviceSalon=new SalonService();
	private Salon salon=new Salon();
	
	@ManagedProperty("#{detalleComboBebidaService}")
	private DetalleComboBebidaService serviceDetalleComboBebida=new DetalleComboBebidaService();
	List<Detallecombobebida> listaDetalleComboBebida = new ArrayList<Detallecombobebida>();
	private Detallecombobebida detallecombobebidaSelected=new Detallecombobebida();		
	
	private List<Combobebidaxsalon> listaComboBebidaSalon;
	private Combobebidaxsalon combobebidaxsalonSelected;
	
	
	public ConsultarComboBebidaXSalonBean() {
		super();
		listaComboBebidaSalon=new ArrayList<>();;
		combobebidaxsalonSelected=new Combobebidaxsalon();
	}

	@PostConstruct
	private void init() {
        FacesContext context = javax.faces.context.FacesContext.getCurrentInstance();
        HttpSession sessionActual = (HttpSession) context.getExternalContext().getSession(false);
        Integer salonSel = null;
        
        if (sessionActual!= null)
        {  
        salonSel = Integer.parseInt(sessionActual.getAttribute("salon").toString());             
        listaComboBebidaSalon=serviceComboBebidaXSalon.getListacombobebidaxsalon(salonSel);
        salon=serviceSalon.obtenerSalon(salonSel);
        }
        
	}

	public void llenarTablaDetalleComboBebida(){
		listaDetalleComboBebida = serviceDetalleComboBebida.getListadetallecombobebida(comboBebidaSelected.getIdComboBebida());
	}

	public String agregarcombobebida()
	{
		
		return "AgregarComboBebida";
	}

	public ComboBebidaXSalonService2 getServiceComboBebidaXSalon() {
		return serviceComboBebidaXSalon;
	}

	public void setServiceComboBebidaXSalon(
			ComboBebidaXSalonService2 serviceComboBebidaXSalon) {
		this.serviceComboBebidaXSalon = serviceComboBebidaXSalon;
	}

	public Combobebidaxsalon getCombobebidaxsalon() {
		return combobebidaxsalon;
	}

	public void setCombobebidaxsalon(Combobebidaxsalon combobebidaxsalon) {
		this.combobebidaxsalon = combobebidaxsalon;
	}

	public SalonService getServiceSalon() {
		return serviceSalon;
	}

	public void setServiceSalon(SalonService serviceSalon) {
		this.serviceSalon = serviceSalon;
	}

	public Salon getSalon() {
		return salon;
	}

	public void setSalon(Salon salon) {
		this.salon = salon;
	}

	public DetalleComboBebidaService getServiceDetalleComboBebida() {
		return serviceDetalleComboBebida;
	}

	public void setServiceDetalleComboBebida(
			DetalleComboBebidaService serviceDetalleComboBebida) {
		this.serviceDetalleComboBebida = serviceDetalleComboBebida;
	}

	public List<Detallecombobebida> getListaDetalleComboBebida() {
		return listaDetalleComboBebida;
	}

	public void setListaDetalleComboBebida(
			List<Detallecombobebida> listaDetalleComboBebida) {
		this.listaDetalleComboBebida = listaDetalleComboBebida;
	}

	public Detallecombobebida getDetallecombobebidaSelected() {
		return detallecombobebidaSelected;
	}

	public void setDetallecombobebidaSelected(
			Detallecombobebida detallecombobebidaSelected) {
		this.detallecombobebidaSelected = detallecombobebidaSelected;
	}

	public Combobebidaxsalon getCombobebidaxsalonSelected() {
		return combobebidaxsalonSelected;
	}

	public void setCombobebidaxsalonSelected(
			Combobebidaxsalon combobebidaxsalonSelected) {
		this.combobebidaxsalonSelected = combobebidaxsalonSelected;
	}

	public ComboBebidaService getCombobebidaService() {
		return combobebidaService;
	}

	public void setCombobebidaService(ComboBebidaService combobebidaService) {
		this.combobebidaService = combobebidaService;
	}

	public Combobebida getComboBebidaSelected() {
		return comboBebidaSelected;
	}

	public void setComboBebidaSelected(Combobebida comboBebidaSelected) {
		this.comboBebidaSelected = comboBebidaSelected;
	}

	public List<Combobebida> getListaComboBebida() {
		return listaComboBebida;
	}

	public void setListaComboBebida(List<Combobebida> listaComboBebida) {
		this.listaComboBebida = listaComboBebida;
	}

	public List<Combobebidaxsalon> getListaComboBebidaSalon() {
		return listaComboBebidaSalon;
	}

	public void setListaComboBebidaSalon(List<Combobebidaxsalon> listaComboBebidaSalon) {
		this.listaComboBebidaSalon = listaComboBebidaSalon;
	}
	
	
	
}

	